STEP 1: This cheer code is inefficient. We wrote many of the same exact commands FOUR times!

  • Place a #comment on the line above the beginning of the first section of code that is used more than once.
  • Place a #comment on the line below the end of the first section of code that is used more than once.

Code that repeats with different values can be placed in a function with a parameter. Then, the function can be called more than once with different arguments each time!

To navigate the page using the TAB key, first press ESC to exit the code editor.

# THIS ACTIVITY IS IN PREVIEW ONLY MODE
  • Run Code
  • Submit Work
  • Next Activity
  • Show Console
  • Reset Code Editor
  • Codesters How To (opens in a new tab)